#
# @lc app=leetcode.cn id=3152 lang=python3
#
# [3152] 特殊数组 II
#

# @lc code=start
from itertools import accumulate, pairwise
from typing import List

#i 位置和下一个位置奇偶性不同就设为1 ，否则为0
class Solution:
    def isArraySpecial(self, nums: List[int], queries: List[List[int]]) -> List[bool]:
        s = list(accumulate((x%2 == y%2 for x,y in pairwise(nums)),initial=0))
        return [s[st] == s[ed] for st,ed in queries]
# @lc code=end

